package com.devunion.reader.client.service;

import com.devunion.reader.client.to.ProjectTreeTo;
import com.devunion.reader.client.to.SearchProjectTo;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.ServiceDefTarget;

import java.util.List;

/**
 * @author Timoshenko Alexander 19.08.2009 : 11:18:58
 */
public interface ProjectService extends RemoteService {
    /**
     * Utility/Convenience class.
     * Use ProjectService.App.getInstance() to access static instance of ProjectServiceAsync
     */
    public static class App {
        private static final ProjectServiceAsync ourInstance;

        static {
            ourInstance = (ProjectServiceAsync) GWT.create(ProjectService.class);
            ((ServiceDefTarget) ourInstance).setServiceEntryPoint(GWT.getModuleBaseURL() + "ProjectService.rpc");
        }

        public static ProjectServiceAsync getInstance() {
            return ourInstance;
        }
    }

    List<ProjectTreeTo> getProjectTreeItems(ProjectTreeTo projectTreeTo, SearchProjectTo searchProjectTo);
}
